package org.glorylight.hacks.social.data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.joda.time.DateTime;
import org.joda.time.Period;


public class UserData implements Serializable {

	private static final long serialVersionUID = -2967261796360803852L;
	
	private String emailAddress;
	private String password;
	private String firstName;
	private String lastName;
	private Date birthDate;
	private String gender;
	private String mobileNo;
	private List<UserNetworkData> networks = new ArrayList<UserNetworkData>();
	private String babyName;
	private Date babyBirthDate;
	private float babyAge;
	private String userId;
	private Date registrationDate;
	private Boolean activate;
	
	public UserData(){
	}
	
	public UserData(String emailAddress, String password, String firstName, String lastName, Date birth, String gender, String mobileNo, Date registrationDate, Boolean activated) {
		this.emailAddress = emailAddress;
		this.password = password;
		this.firstName = firstName;
		this.setLastName(lastName);
		this.birthDate = birth;
		this.gender = gender;
		this.mobileNo = mobileNo;
		this.registrationDate = registrationDate;
		this.activate = activated;
	}
	
	//registration step1
	public UserData(String emailAddress, String password, String firstName, String lastName, Date registrationDate, Boolean activated) {
		this.emailAddress = emailAddress;
		this.password = password;
		this.firstName = firstName;
		this.lastName = lastName;
		this.registrationDate = registrationDate;
		this.activate = activated;
	}
	
	public String getEmailAddress() {
		return emailAddress;
	}

	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public Date getBirthDate() {
		return birthDate;
	}

	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public List<UserNetworkData> getNetworks() {
		return networks;
	}

	public void setNetworks(List<UserNetworkData> networks) {
		this.networks = networks;
	}

	public String getMobileNo() {
		return mobileNo;
	}

	public void setMobileNo(String mobileNo) {
		this.mobileNo = mobileNo;
	}

	public String getBabyName() {
		return babyName;
	}

	public void setBabyName(String babyName) {
		this.babyName = babyName;
	}

	public Date getBabyBirthDate() {
		return babyBirthDate;
	}

	public void setBabyBirthDate(Date babyBirthDate) {
		this.babyBirthDate = babyBirthDate;
	}

	public float getBabyAge() {
		if(babyBirthDate != null) {
			DateTime currentDate = new DateTime();
			DateTime birthDate = new DateTime(getBabyBirthDate());
			Period period = new Period(birthDate, currentDate);
			babyAge = new Double(period.getYears() + (0.1*period.getMonths())).floatValue();
		}	
		return babyAge;
	}

	public void setBabyAge(float babyAge) {
		this.babyAge = babyAge;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public Date getRegistrationDate() {
		return registrationDate;
	}

	public void setRegistrationDate(Date registrationDate) {
		this.registrationDate = registrationDate;
	}

	public Boolean isActivated() {
		return activate;
	}

	public void setActivate(Boolean activate) {
		this.activate = activate;
	}
	
	
}
